package com.api.apiinterface.controller;

import cn.hutool.http.HttpUtil;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * 一天一句冷笑话
 */
@RestController
@RequestMapping("/joke")
public class JokeController {
    @GetMapping("/get")
    public Map<String,String> getJokeTest(@RequestParam String charset, @RequestParam String encode, HttpServletRequest request){
        String response = HttpUtil.get("http://api.btstu.cn/yan/api.php?charset="+charset+"&encode="+encode);
        Map<String,String> res = new HashMap<>();
        res.put("text",response);
        return res;
    }
}
